import { http } from "@/plugin/http";

// 获取用户信息
export const getUserInfo = async () => {
  try {
    return await http.post<API.UC.UserInfoDetailResponse>("/uc/profile-detail");
  } catch (error) {
    return null;
  }
};

// 获取用户信息
export const getUserAssets = async () => {
  try {
    return await http.post<API.UC.UserAssetsResponse>("/uc/assets");
  } catch (error) {
    return null;
  }
};

// 随机用户头像
export const generateUserHead = async () => {
  try {
    await http.post("/uc/generate-user-head");
    return true;
  } catch (error) {
    return false;
  }
};

// 获取盒子历史列表
export const getBoxHistoryList = async (params: API.UC.PagerParams) => {
  try {
    return await http.post<API.UC.BoxHistoryResponse>(
      "/uc/box-history",
      params
    );
  } catch (error) {
    return null;
  }
};

// 充值记录
export const getDepositList = async (params: API.UC.PagerParams) => {
  try {
    return await http.post<API.UC.DepositListResponse>(
      "/uc/deposit-history",
      params
    );
  } catch (error) {
    return null;
  }
};

// 提现记录
export const getWithdraw = async (params: API.UC.PagerParams) => {
  try {
    return await http.post<API.UC.WithdrawHistoryResponse>(
      "/uc/withdraw-history",
      params
    );
  } catch (error) {
    return null;
  }
};

// 商品售卖记录
export const getSales = async (params: API.UC.PagerParams) => {
  try {
    return await http.post<API.UC.SaleHistoryResponse>(
      "/uc/sale-history",
      params
    );
  } catch (error) {
    return null;
  }
};

// 开启的Forge记录
export const getForges = async (params: API.UC.PagerParams) => {
  try {
    return await http.post<API.UC.ForgeHistoryResponse>(
      "/uc/forge-history",
      params
    );
  } catch (error) {
    return null;
  }
};

// 发货列表
export const getDeliver = async (params: API.UC.PagerParams) => {
  try {
    return await http.post<API.UC.DeliverListResponse>(
      "/uc/deliver-list",
      params
    );
  } catch (error) {
    return null;
  }
};

// 获取battles列表
export const getBattlesList = async (params: API.Battles.BattleListParams) => {
  try {
    return await http.post<API.Battles.BattleListResponse>(
      "/uc/battle-history",
      params
    );
  } catch (error) {
    return null;
  }
};
